{% extends 'nourish/base.html' %}
{% load nourish %}
{% block title %}Home{% endblock %}

{% block content %}

{% if guest_invites %}
  <div style="float: left;">
  <h2>My Invitations</h2>
  <ul class="invitelist">
    {% for invite in guest_invites %}
    <li class="{% if invite.state != 'C' %}unconfirmed{% endif %}">
      <a href="{% nurl invite.host_eg %}">{{ invite.host_eg.group.name }}</a> invited <a href="{% nurl invite.guest_eg %}">{{ invite.guest_eg.group.name }}</a> to dinner on {{ invite.meal.date }}.
      <br/>
      <strong>Time:</strong> <em>{{ invite.dinner_time }}</em>
      <strong>Location:</strong> <em>{{ invite.host_eg.playa_address|default:"TBD" }}</em>
      {% if invite.state == 'C' %}
        <em>(Confirmed)</em>
      {% else %}
        <form method="post" action="/nourish/confirm_invite/">
          <input type="hidden" name="invite_id" value="{{ invite.id }}">
          <input type="hidden" name="next" value="{{ request.path }}">
          <strong>You need to confirm this invitation!</strong>
          <input type=submit value="Confirm Invitation">
        </form>
      {% endif %}
      </li>
    {% endfor %}
  </ul>
  </div>
{% endif %}

<div style="clear: both;"></div>

<div style="float: left;">
<h2>Upcoming Events</h2>
{% if events or egs %}
  <ul class="small_list">
  {% for event in events %}
    <li>{% include "nourish/event_small.html" with event=event %}</li>
  {% endfor %}
  {% for eg in egs %}
      <li>{% include "nourish/eg_small.html" with eg=eg %}</li>
  {% endfor %}
  </ul>
{% else %}
  <p>You aren't currently attending any events.</p>
{% endif %}
</div>

<div style="float: left;">
<h2>My Groups</h2>
{% if groups %}
  <ul class="small_list">
  {% for group in groups %}
    <li>{% include "nourish/group_small.html" with group=group %}</li>
  {% endfor %}
  </ul>
{% else %}
  <p>You aren't currently a member of any groups</p>
{% endif %}
</div>
<div style="clear: both;"></div>


{% endblock %}
